Ubuntu Things

How to automatically bring an activated window to the foreground in Ubuntu?

This behaviour can be changed from the command line, open a terminal and type:

1
dconf write /org/compiz/profiles/unity/plugins/core/focus-prevention-level 0

To restore the default value:

1
dconf write /org/compiz/profiles/unity/plugins/core/focus-prevention-level 1

激活窗口不前置

ubuntu下,比如当前已打开文件管理器,然后在浏览器中打开 Downloads文件夹目录时文件管理器不前置。
解决方法:
打开CompizConfig SettingManager,选择General Options,选择focus & raise behavious 这个tab,将 focus prevention level 置为 off

Disable ubuntu internal error report

just disable the apport:
open /etc/default/apport
then change enable=1 to enable=0

Forget passwd

boot into recovery mode, choose “drop to root shell prompt”
remount it with write permissions:

1
mount -rw -o remount /

now you can do everything you want.

Recode keyboard input to a file

recode keycode to key.log:

1
2
3
xinput list | grep -Po 'id=\K\d+(?=.*slave\s*keyboard)' | xargs -P0 -n1 xinput test > key.log
convert keycode to keyname:
awk 'BEGIN{while (("xmodmap -pke" | getline) > 0) k[$2]=$4} {print $0 "[" k[$NF] "]"}' < key.log

Downgrade a package via apt-get

  • Find package’s available versions

    1
    apt-cache showpkg <package-name> # list all available versions
  • Downgrade the package to the available version

    1
    2
    3
    sudo apt-get install <package-name>=<package-version-number>
    # or
    sudo apt-get install -t=<target release> install <package-name>
  • Hold the package at the current version if necessary

    1
    apt-mark hold <package-name>

Exact and compress a debian package

using dpkg-deb:

1
2
3
4
# exact
dpkg-deb -R package-name.deb target_directory
# compress
dpkg-deb -b target_directory package-name